const express = require('express')
const cors = require('cors')
const router = require('./router/router')
const employRouter = require('./router/employRouter')
const bodyParser = require('body-parser')
const session = require('express-session')
const cookieParser = require('cookie-parser')
const { startServer } = require('./static/static')

const app = express()


app.use(cookieParser())
app.use(session({
    secret: "keyboard",
    resave: true,
    saveUninitialized: true,
    cookie: { maxAge: 5 * 60 * 1000, secure: false }
}))

const port = 3301

//允许跨域
app.use(cors())
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }))
app.use(bodyParser.json({ limit: '50mb' }))

app.use(router)
app.use(employRouter)
startServer()



app.listen(port, () =>
    console.log(`服务器已启动，端口： ${port}!`)
)